package com.wangyk.rabbitmqconsole.message;

import com.wangyk.rabbitmqcommon.model.console.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.stereotype.Component;

/**
 * 接收端的定义
 */
@Component
//绑定的接口
@EnableBinding(StreamClient.class)
@Slf4j
public class StreamReceiver
{
    /**
     * 设置监听的队列
     */
    @StreamListener(value = StreamClient.INPUT)
    public void process(Object object)
    {
        System.out.println("==================================================");
        log.info("streamReceiver:{}", object,(User)object);
        User user=(User)object;
        System.out.println("user:"+user);
        log.info("user:{}", user);
        System.out.println("==================================================");
    }
}
